import request from '@/utils/request'

// 查询附件管理列表
export function listAttachment (query) {
    return request({
        url: '/system/attachment/list',
        method: 'get',
        params: query
    })
}
export function listCourseAttachment (query) {
    return request({
        url: '/system/courseAttachment/list',
        method: 'get',
        params: query
    })
}

// 查询附件管理详细
export function getAttachment (id) {
    return request({
        url: '/system/attachment/' + id,
        method: 'get'
    })
}

// 新增附件管理
export function addAttachment (data) {
    return request({
        url: '/system/attachment',
        method: 'post',
        data: data
    })
}

// 修改附件管理
export function updateAttachment (data) {
    return request({
        url: '/system/attachment',
        method: 'put',
        data: data
    })
}

// 删除附件管理
export function delAttachment (id) {
    return request({
        url: '/system/attachment/' + id,
        method: 'delete'
    })
}

// 删除课程-附件管理
export function delCourseAttachment (courseId, ids) {
    return request({
        url: `/system/courseAttachment/remove`,
        method: 'post',
        data: {
            "courseId": courseId,
            "ids": ids
        }
    })
}

// 导出附件管理
export function exportAttachment (query) {
    return request({
        url: '/system/attachment/export',
        method: 'get',
        params: query
    })
}

// 将课件添加到课程
export function courseAddAttchment (data) {
    return request({
        url: '/system/course/courseAddAttachment',
        method: 'post',
        data: data
    })
}